19. Continuous Integration
Continuous Integration
ND079 JPND C3 L5 A13 Continuous Integration
CI/CD - Continous Integration / Continuous Delivery
Continuous Integration refers to the process of automatically running unit tests any time your code changes. It usually is performed by a service that monitors the state of your repository and runs all your unit tests whenever you commit new changes.
Continuous Delivery is a process that follows CI and involves creating deployable build artifacts every time the project changes.
Containerization means creating a self-contained environment with known parameters to build and run your application.
Docker is an application that provides a container format and an engine that can run those containers.
Demo
ND079 JPND C3 L5 A14 Demo Continuous Integration
CircleCI and GitHub
The above video demonstrates how to set up a new CircleCI project for a GitHub repository. You will need an account with https://github.com/ if you wish to follow along. It goes through the following steps:
- Create a new repository on GitHub
- Check out the repository and copy a Java project into the repository. The demo uses the project
lesson6
from the solutions set because it has a variety of unit tests in it, but any Java Maven project will work for our example. - Push your change to the repository.
- Navigate to app.circleci.com and log in with your GitHub account.
- Click on the Projects tab and then **Set Up Project **from the repository you just created.
- Select **Maven(Java) **from the dropdown.
- Update the
orbs: maven:
to use versioncircleci/maven
@1.0.3
and then press Add Config. CircleCI creates a new file calledconfig.yml
in the directory.circleci
and pushes this change to a new branch calledcircleci-project-setup
. - Click into the running project. The Run Test step fails, because our Java Version of 14 is higher than the default Docker install (which uses Java 13)
- Modify the file
.circleci/config.yml
on the circleci-project-setup branch to use a different docker image (file below) and push the change to the repository. - Go back to CircleCI and observe the build finish successfully.
config.yml
version: 2.1
orbs:
maven: circleci/maven@1.0.3
executors:
docker-java:
docker:
- image: cimg/openjdk:14.0.0
workflows:
maven_test:
jobs:
- maven/test:
executor: docker-java